package com.neusoft.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.neusoft.entity.Book;
import com.neusoft.entity.BookExample;
import com.neusoft.mapper.BookMapper;
import com.neusoft.service.BookService;

@Service
public class BookServiceImpl implements BookService {

	@Autowired
	BookMapper bookMapper;

	@Override
	public int addBookSelective(Book record) {
		return bookMapper.insertSelective(record);
	}

	@Override
	public List<Book> loadBookListByExample(BookExample example) {
		return bookMapper.selectByExample(example);
	}

	@Override
	public Book loadBookByBookId(Integer bId) {
		return bookMapper.selectByPrimaryKey(bId);
	}

	@Override
	public int updateBookByBookIdSelective(Book record) {
		return bookMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	@Transactional
	public int deleteBookByBookId(Integer bId) {
		return bookMapper.deleteByPrimaryKey(bId);
	}

}
